package fi.profecons.csswindows.toolkit;

import fi.profecons.csswindows.Element;

public class CheckBox extends Element {

	private String value = new String();
	
	private boolean selected = false;

	private String type;

	private String name;

	public CheckBox() {
		super();
		this.type = "checkbox";
		addCommand("new Input('" + getId() + "' , '" + type+"');");
	}

	public CheckBox(String name) {
		this.name = name;
		this.type = "checkbox";
		addCommand("new Input('" + getId() + "', '" + type +"', '" + name + "');");
	}

	public String getName() {
		return name;
	}
	
	public void setSelected(boolean selected){
		this.selected = selected;
		if(this.selected){
			addCommand("getElement('" + getId() + "').enabledElement.checked = true;");
		}
		else{
			addCommand("getElement('" + getId() + "').enabledElement.checked = false;");
		}
	}
}
